<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;
use think\model\concern\SoftDelete;

/**
 * @property int $deletetime
 * @property int $id
 * @property int $pid
 * @property string $createtime
 * @property string $name
 * @property-read \app\model\ProjectLife $parent
 * @property-read \app\model\ProjectLife[] $children
 * @method static \think\db\Query onlyTrashed()
 * @method static \think\db\Query withTrashed()
 * @mixin \think\Model
 */
class ProjectLife extends Model
{
	use SoftDelete;
	//
	protected $createTime = 'createtime';
	protected $deleteTime = 'deletetime';
	function children()
	{
		return $this->hasMany(ProjectLife::class, 'pid', 'id');
	}
	
	function parent()
	{
		return $this->belongsTo(ProjectLife::class, 'pid', 'id');
	}
	
}
